#pragma once
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cstring>
#include <memory>
enum ERROR{
    success = 0,
    error = -1,
};
class Netaddr {
private:
    struct sockaddr_in addr_{};
public:
    Netaddr(){}
    explicit Netaddr(int port) {
        addr_.sin_family      = AF_INET;
        addr_.sin_port        = htons(port);
        addr_.sin_addr.s_addr = htonl(INADDR_ANY);
    }
    struct sockaddr* getAddr() { return (struct sockaddr*)&addr_; }
    socklen_t getLen()  const  { return sizeof(addr_); }
};